package com.singzi.leetcode.jianzhiOffer;


public class T0006 {
}
class Solution0006 {
    public int[] reversePrint(ListNode head) {
        ListNode listNode = head;
        int count = 0;
        while (listNode!=null){
            count++;
            listNode = listNode.next;
        }
        int[] result = new int[count];

        while (head!=null){
            result[count-1] = head.val;
            count--;
            head = head.next;
        }
        return  result;
    }
}